INCLUDE_DIRECTORIES(${FLOWVR_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${GLUT_INCLUDE_DIR})

SET(KVS_LIBRARIES kvsSupportGLEW kvsSupportGLUT kvsCore m GLEW)
SET(KVS_DIR $ENV{KVS_DIR})
LINK_DIRECTORIES(${KVS_DIR}/lib /opt/local/lib)
INCLUDE_DIRECTORIES(${KVS_DIR}/include /opt/local/include)
ADD_DEFINITIONS(-DKVS_SUPPORT_GLUT -DKVS_SUPPORT_GLEW)

IF(BUILD_MODULES)

  FOREACH(target PixelSend PixelDraw ParticleSend ParticleDraw)

    ADD_EXECUTABLE(${target} ${target}.cpp)

    TARGET_LINK_LIBRARIES(${target} ${KVS_LIBRARIES}
                                    ${OPENGL_LIBRARIES}
                                    ${GLUT_LIBRARIES}
                                    ${FLOWVR_base_LIBRARY}
                                    ${FLOWVR_ftl_LIBRARY}
                                    ${FLOWVR_mod_LIBRARY}
                                    ${CMAKE_THREAD_LIBS_INIT})
    INSTALL(TARGETS ${target} DESTINATION ${MODULE_DIR})

  ENDFOREACH(target)

ENDIF(BUILD_MODULES)
